package com.liuhangs.learning.crowd.webui.bean;

import com.liuhangs.learning.crowd.webui.bean.exception.ErrorCode;

/**
 * 接口返回给前端结果
 * @author 11757
 * @DATE 2020/6/11
 */
public class AdminResponse {

    private  int code;

    private String message;

    private Object data;

    public AdminResponse()
    {
    }

    public AdminResponse(int code, String message)
    {
        this.code = code;
        this.message = message;
    }

    public AdminResponse(int code, String message, Object data)
    {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static AdminResponse fail(ErrorCode errorCode){
        return new AdminResponse(errorCode.getCode(), errorCode.getMsg());
    }

    public int getCode()
    {
        return code;
    }

    public void setCode(int code)
    {
        this.code = code;
    }

    public String getMessage()
    {
        return message;
    }

    public void setMessage(String message)
    {
        this.message = message;
    }

    public Object getData()
    {
        return data;
    }

    public void setData(Object data)
    {
        this.data = data;
    }
}
